﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace RenjianImageViewer.DataModel
{
    class UserModel
    {
        private long id;

        public string NickName { get; private set; }
        public string UserName { get; private set; }
        public string Location { get; private set; }
        public string Gender { get; private set; }
        public string Avater { get; private set; }

        public UserModel(string xmlString) :
            this(XElement.Parse(xmlString))
        {
        }

        public UserModel(XElement userElement)
        {
            id = (long)userElement.Element("id");

            NickName = userElement.Element("name").Value;
            UserName = userElement.Element("screen_name").Value;
            //Location = userElement.Element("location").Value;
            Avater = userElement.Element("profile_image_url").Value;
            Gender = userElement.Element("gender").Value == "1" ? "DeepSkyBlue" : "Pink";
        }
    }
}
